<?php
require_once("phpmailer/class.phpmailer.php");

// sanitize input
$sanitized_name = preg_replace("/[^. a-zA-Z0-9]/", "", $_POST['name']);
$sanitized_email = preg_replace("/[^.@a-zA-Z0-9]/", "", $_POST['email']);

// php mailer 
$mail = new PHPMailer();
$mail->IsSMTP(); // send via SMTP
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "support@wolfdisc.com"; // SMTP username
$mail->Password = "supp0rt123!"; // SMTP password
$webmaster_email = "support@wolfdisc.com"; //Reply to this email ID
$email="support@wolfdisc.com"; // Recipients email ID
$name="User Registration"; // Recipient's name	

// email configs
$mail->From = $webmaster_email;
$mail->FromName = "WolfDisc User Registration";
$mail->AddAddress($email,$name); 
$mail->AddReplyTo($webmaster_email,"WolfDisc Support");
$mail->WordWrap = 50; // set word wrap
$mail->IsHTML(true); // send as HTML

$mail->Subject = "New WolfDisc User Registration";
$mail->Body = "A new user has registered on WolfDisc.com <br><br>Name: ". $sanitized_name
."<br/>Email: ". $sanitized_email; //HTML Body

if(!$mail->Send()){
	echo "Mailer Error. Please try again ";
}
else{
	echo "
	<html>
	<head>
	<script type=\"text/javascript\">
	<!--
	function delayer(){
	window.location = \"index.html\"
	}
	//-->
	</script>
	</head>
	<body onLoad=\"setTimeout('delayer()', 10000)\" bgcolor=\"black\" style=\"color:white;\">
	Thank you! You will be notified as soon as WolfDisc is available.</body></html>";
}

?>
